package com.huangliusong.demohls;

import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata;

public class InitConditional implements Condition {
    @Override
    public boolean matches(ConditionContext conditionContext, AnnotatedTypeMetadata annotatedTypeMetadata) {

        System.out.println("判断是否存在bean");
        Boolean b=conditionContext.getBeanFactory().containsBean("amazonTest");
        return b;
    }
}
